// components/circleprocess/index.ts



const computedBehavior = require("miniprogram-computed").behavior;


 
Component({
  behaviors: [computedBehavior],

  computed: {
    leftdeg(data) {
      if(data.deg>=180) {
        return 'transform: rotateZ('+(data.deg-180)+'deg)';
      } else {
          return 'transform: rotateZ(0deg)'
      }
    },
    rightdeg(data) {
      if(data.deg>=180) {
        return 'transform: rotateZ(180deg)';
      } else {
          return 'transform: rotateZ('+data.deg+'deg)'
      }
    },
  },
  /**
   * 组件的属性列表
   */
  properties: {
    process: {type:Number,value:10},
    deg: {type:Number,value:0},
    
  },

  /**
   * 组件的初始数据
   */
  data: {
    leftdeg:'',
    rightdeg:'',
    deg:0,
    process:0,
    aaa:123
  },

  /**
   * 组件的方法列表
   */
  methods: {
     changeToDeg(deg: number) {
       var right = 0;
       var left =0 ; 
      if(deg>=180) {
          right=180;
          left=deg-180;
      } else {
        right= deg;
        left=0;
      }
      this.setData({
        leftdeg:'transform: rotateZ('+left+')',
        rightdeg:'transform: rotateZ('+right+')'
      });

     }
  }

})